<template>
	<view>
		<view class="tabbar"></view>
		<view class="occupy"></view>
		<view class="navigation-bar" :class="$isPC ? 'IsPC':''">
			<view @click="dingwei()" class="list left fex1" v-if="title==='首页'">
				<text style="margin-right: 8upx;"  class="iconfont icon-dingwei"></text>
				{{address.address.city}}
			</view>
			<view class="list left fex1" v-else>
				{{title}}
			</view>
			<view class="list center" v-if="!reviewVersion">
				<text>{{isLogin?currency.toFixed(5):'0.0000'}}</text> 
				<text>zkb</text>
			</view>
			<view v-if="!reviewVersion" class="list right" @click="goPage('/pages/mini/index')">
				<!-- 10初始算力 2秒计算一次 -->
				<button v-if="isOpenMini&&isLogin">≈ {{(power/200).toFixed(2)}}/hr</button>
				<button v-else>探索</button>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex';
	import {getPosition} from "@/utils/util.js"
	export default {
		name: "Navigationbar",
		props: {
			title: {
				type: String,
				default: "",
				IsPC: false
			}
		},
		computed: {
			...mapState(['isLogin','currency', 'power', 'isOpenMini','reviewVersion','address']),
		},
		mounted() {
		},
		methods: {
			goPage(url){
				uni.navigateTo({
					url:url
				})
			},
			async dingwei(){
				let address = await getPosition(1);
				if(address.errMsg){
					this.$msg("位置更新成功")
				}
			}
		},
		
	}
</script>

<style lang="less" scoped src="./BlockBar.less"></style>
